package com.woniuxy.usersecurity.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.GrantedAuthority;

import java.io.Serializable;

/**
 * <p>
 * 权限表
 * </p>
 *
 * @author zhangxianhui
 * @since 2020-09-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("\"PERMISSION\"")
@ApiModel(value="Permission对象", description="权限表")
@KeySequence("SEQ_PERMISSION")
public class Permission implements Serializable, GrantedAuthority {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "权限编号")
    @TableId(value = "PERMISSION_ID",type = IdType.INPUT)
    private Integer permissionId;

    @ApiModelProperty(value = "权限名称")
    @TableField("PERMISSION_NAME")
    private String permissionName;

    @ApiModelProperty(value = "权限描述")
    @TableField("PERMISSION_DESCRIPTION")
    private String permissionDescription;

    @ApiModelProperty(value = "权限状态")
    @TableField("PERMISSION_STATUS")
    private Integer permissionStatus;


    @JsonIgnore
    @Override
    public String getAuthority() {
        return permissionName;
    }
}
